function [] = guitext(text_title, text_string);

% GUITEXT - display provided text in a scroll box
%
%    GUITEXT(TITLE, TEXT) creates a figure window named TITLE
%    containing a list box for displaying the text strings
%    provided by the cell array TEXT.

% By:   S.C. Molitor (smolitor@bme.jhu.edu)
% Date: April 20, 1999

% check input parameters

if (nargin ~= 2)
   return
elseif (~ischar(text_title))
   return
elseif (~iscell(text_string))
   return
end

% determine size & position of list box figure

max_char = size(char(text_string), 2);
max_line = size(char(text_string), 1);
text_width = min(max((0.04 + 0.008525 * max_char), 0.12), 0.8);
text_height = min(max((0.02 + 0.01872 * max_line), 0.2), 0.8);
text_pos = [(1 - text_width)/2 (1 - text_height)/2 text_width text_height];

% create a new figure window to hold the list box

h_fig = figure('Color', [0.8 0.8 0.8], ...
   'Units', 'normalized', ...
   'Position', text_pos, ...
   'MenuBar', 'none', ...
   'Name', text_title, ...
   'NumberTitle', 'off');

% create a list box with the items provided

h_textbox = uicontrol('Parent', h_fig, ...
   'Style', 'listbox',...
   'Units', 'normalized', ...
   'Position', [0.05 0.05 0.90 0.90], ...
   'BackgroundColor', [1 1 1], ...
   'Min', 1, 'Max', 2, 'Value', 1, ...
   'String', text_string, ...
   'FontName', 'Courier', ...
   'FontSize', 12);
return
